#ifndef _FBOMANAGER_
#define _FBOMANAGER_

#include <vector>

#define BAD_INDEX UINT_MAX

#ifdef _DEBUG
#define FBOERR(msg, cap, retval) {MessageBoxA(NULL, msg, cap, MB_OK|MB_ICONEXCLAMATION); return retval;}
#else
#define FBOERR(msg, cap, retval) return retval;
#endif // _DEBUG

class FBOManager
{
private:
	int m_drawBuffer;
	unsigned m_FBO;
	unsigned m_depthbuff; 	//depthbuffer will be the same for all
	unsigned m_stencilBuffer;
	unsigned m_SceneImg;		//SceneImg is the entire scene which all FBOs will be plastered on
	int m_MaxBuffers;

	int m_screenWidth;
	int m_screenHeight;

	//Private Instance
	static FBOManager m_Instance;

	FBOManager();
	~FBOManager();
	FBOManager(const FBOManager&);
	FBOManager& operator=(const FBOManager&);

public:
	////////////////////////////////////////////////
	//	GetInstance
	//	Returns an Instance of the class
	////////////////////////////////////////////////
	static FBOManager* GetInstance(void)	{	return &m_Instance;		}

	bool Init(int _screenWidth, int _screenHeight);
	void Shutdown(void);
	bool PushFBO(void);
	bool PopFBO(void);

	void Resize(int _screenWidth, int _screenHeight);

	void DrawScreenAlignedQuad();

	int GetMaxBuffers(void)	{	return m_MaxBuffers;	}

};

#endif